package ar.edu.unq.persistencia.gpilla;

import java.lang.reflect.InvocationTargetException;

/**
 * TODO: description
 */
public class FormacionFactory {

    @SuppressWarnings("unchecked")
	public static FormacionAbstract geFormacion(final String estrategia) {
        Class formacionClass;
        FormacionAbstract formacion;

        try {
            formacionClass = Class.forName("ar.edu.unq.persistencia.gpilla." + "Formacion" + estrategia);
            formacion = (FormacionAbstract) formacionClass.getConstructor(null).newInstance(null);
        } catch (ClassNotFoundException e) {
        	e.printStackTrace();
            throw new UnsupportedOperationException();
        } catch (IllegalArgumentException e) {
            throw new UnsupportedOperationException();
        } catch (SecurityException e) {
            throw new UnsupportedOperationException();
        } catch (InstantiationException e) {
            throw new UnsupportedOperationException();
        } catch (IllegalAccessException e) {
            throw new UnsupportedOperationException();
        } catch (InvocationTargetException e) {
            throw new UnsupportedOperationException();
        } catch (NoSuchMethodException e) {
            throw new UnsupportedOperationException();
        }

        return formacion;
    }
}
